<template>
  <div>earth</div>
</template>

<script>
export default {
  data() {
    return {
      checkedValue: [],
    };
  },
  watch: {
    checkedValue: {
      immediate: false,
      deep: true,
      handler(val) {
        console.log(val + "调接口");
      },
    },
  },
  mounted() {
    this.checkedValue = localStorage.getItem("leftChecked1"); //初始化当前页面的数据
    //监听locastorage 变化
    window.addEventListener("storage", (e) => {
      this.$nextTick(() => {
        if (e.key == "leftChecked1") this.checkedValue = e.newValue; //将最新的值 赋值给当前页面的数据
      });
    });
  },
};
</script>

<style>
</style>